package com.blueocean_health.care.management.controller;

import com.blueocean_health.care.management.common.LocalManager;
import com.blueocean_health.care.management.domain.base.User;
import com.blueocean_health.care.management.em.LocalManagerType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.blueocean_health.care.management.domain.base.SysResult;
import com.blueocean_health.care.management.domain.dto.OrderInfoPriceDto;
import com.blueocean_health.care.management.domain.dto.OrderInfoPriceRespDto;
import com.blueocean_health.care.management.exception.OrderException;
import com.blueocean_health.care.management.service.OrderInfoPriceService;

@RestController
@RequestMapping(value = "/web/price", produces = MediaType.APPLICATION_JSON_VALUE)
public class PriceController {
	
	@Autowired
	private OrderInfoPriceService orderInfoPriceService;
	
	@RequestMapping("/findPrice")
    public SysResult findPrice(@RequestBody(required=false) OrderInfoPriceDto orderInfoPriceDto) throws OrderException {
        User courrentUser = LocalManager.getVal(LocalManagerType.USER_WEB);
        String hid =  courrentUser.getHospitalId();
        orderInfoPriceDto.setHid(hid);
        OrderInfoPriceRespDto findPricenew = orderInfoPriceService.findPricenew(orderInfoPriceDto);
        return SysResult.ok(findPricenew);
    }
	
}
